<?php
/**
* @version $Id: mod_login.php 7211 2007-04-29 02:26:51Z robs $
* @package Joomla
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );

global $mosConfig_frontend_login;

if ( $mosConfig_frontend_login != NULL && ($mosConfig_frontend_login === 0 || $mosConfig_frontend_login === '0')) {
	return;
}

// url of current page that user will be returned to after login
if ($query_string = mosGetParam( $_SERVER, 'QUERY_STRING', '' )) {
	$return = 'index.php?' . $query_string;
} else {
	$return = 'index.php';
}

$registration_enabled 	= $mainframe->getCfg( 'allowUserRegistration' );
$message_login 			= $params->def( 'login_message', 	0 );
$message_logout 		= $params->def( 'logout_message', 	0 );
$login 					= $params->def( 'login', 			$return );
$logout 				= $params->def( 'logout', 			$return );
$name 					= $params->def( 'name', 			1 );
$greeting 				= $params->def( 'greeting', 		1 );
$pretext 				= $params->get( 'pretext' );
$posttext 				= $params->get( 'posttext' );

if ( $my->id ) {
// Logout output
// ie HTML when already logged in and trying to logout
	if ( $name ) {
		$name = $my->name;
	} else {
		$name = $my->username;
	}
	?>
	<form action="<?php echo sefRelToAbs( 'index.php?option=logout' ); ?>" method="post" name="logout">

	
	
			<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<?php /*?>	<tr><td>
	<br />	
	<?php
	if ( $greeting ) {
		echo _HI;
		echo $name;
	}
	?></td></tr>
	<tr><td>&nbsp;</td></tr><?php */?>

<tr align="left"><td><a class="mainlevel" href="http://linux/index.php?option=com_user&task=UserDetails&Itemid=21">Your Details</a></td></tr>
<tr align="left"><td><a class="mainlevel" href="http://linux/index.php?option=com_content&task=new&sectionid=1&Itemid=0">Submit News</a></td></tr>
<tr align="left"><td><a class="mainlevel" href="http://linux/index.php?option=com_weblinks&task=new&Itemid=14">Submit WebLink</a></td></tr>
<tr align="left"><td><a class="mainlevel" href="http://linux/index.php?option=com_user&task=CheckIn&Itemid=15">Check-In My Items</a></td></tr>
<tr align="left"><td><a class="mainlevel" href="http://linux/index.php?option=com_login&Itemid=16">Logout</a></td></tr>
<tr align="left"><td><a class="mainlevel" href="http://linux/index.php?option=com_mycontent&Itemid=33">My Content</a></td></tr>
<tr align="left"><td><a class="mainlevel" href="http://linux/index.php?option=com_mamblog&task=edit&Itemid=37">Write a blog entry</a></td></tr>
<tr align="left"><td><a class="mainlevel" href="http://linux/index.php?option=com_mamblog&task=show&action=showmyblog&Itemid=37">Show your blog</a></td></tr>



<tr><td>
	
		 
		  <div align="right">
		    <input type="submit" name="Submit" class="button" value="<?php echo _BUTTON_LOGOUT; ?>" /> &nbsp;&nbsp;&nbsp;&nbsp;
	      </div></td></tr>
</tbody></table>
	
	 



	<input type="hidden" name="option" value="logout" />
	<input type="hidden" name="op2" value="logout" />
	<input type="hidden" name="lang" value="<?php echo $mosConfig_lang; ?>" />
	<input type="hidden" name="return" value="<?php echo htmlspecialchars( sefRelToAbs( $logout ) ); ?>" />
	<input type="hidden" name="message" value="<?php echo htmlspecialchars( $message_logout ); ?>" />
	</form>
	<?php
} else {
// Login output
// ie HTML when not logged in and trying to login
	// used for spoof hardening
	$validate = josSpoofValue(1);
	?>
	<form action="<?php echo sefRelToAbs( 'index.php' ); ?>" method="post" name="login" >
	<?php
	echo $pretext;
	?>

	<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
		<td>
		
		<div  >
		
		<!--begin-->
		


			
		 
		
			
					<table  >
  <tr>
    <td width="53"><label for="mod_login_username">
				<?php echo _USERNAME; ?>
			</label></td>
    <td width="198"><input name="username" id="mod_login_username" type="text" class="inputbox" alt="username" size="20" /></td>
  </tr>
  <tr>
    <td>	<label for="mod_login_password">
				<?php echo _PASSWORD; ?>
			</label></td>
    <td><input name="passwd" type="password" class="inputbox" id="mod_login_password" size="20" alt="password" /></td>
  </tr>
  <tr>
    <td align="right">&nbsp;</td>
    <td align="right"><input type="checkbox" name="remember" id="mod_login_remember" class="inputbox" value="yes" alt="Remember Me" />
      <label for="mod_login_remember"> <?php echo _REMEMBER_ME; ?> </label>
      <input type="submit" name="Submit2" class="button" value="<?php echo _BUTTON_LOGIN; ?>" /></td>
  </tr>
  <tr>
    <td colspan="2">			<a href="<?php echo sefRelToAbs( 'index.php?option=com_registration&amp;task=lostPassword' ); ?>">
				<?php echo _LOST_PASSWORD; ?></a></td>
    </tr>
  <tr>
    <td colspan="2">					<?php
	if ( $registration_enabled ) {
		?>
			 		
				<?php echo _NO_ACCOUNT; ?>
				<a href="<?php echo sefRelToAbs( 'index.php?option=com_registration&amp;task=register' ); ?>">
					<?php echo _CREATE_ACCOUNT; ?></a>
		 
		<?php
	}
	?></td>
    </tr>
</table>
			
	 
			
			
				
				
				

	
	
	
	<!-- end  -->
	
	</div>
		</td>
	</tr>
 

	</table>
	<?php
	echo $posttext;
	?>

	
			


	<input type="hidden" name="option" value="login" />
	<input type="hidden" name="op2" value="login" />
	<input type="hidden" name="lang" value="<?php echo $mosConfig_lang; ?>" />
	<input type="hidden" name="return" value="<?php echo htmlspecialchars( sefRelToAbs( $login ) ); ?>" />
	<input type="hidden" name="message" value="<?php echo htmlspecialchars( $message_login ); ?>" />
	<input type="hidden" name="force_session" value="1" />
	<input type="hidden" name="<?php echo $validate; ?>" value="1" />
	</form>
	<?php
}
?>